<template>
	<view class='loginView'  >
		<view class="input-view">
			<text class="show">头像</text>
			<image class="img" :src="hospitalInfo.headPortrait"></image>
		</view>
		<view class="input-view">
			<text class="show" >医院名字</text>
			<text class="showtele">{{hospitalInfo.nickname}}</text>
		</view>
		<view class="input-view">
			<text class="show" >手机号码</text>
			<text class="showtele" >{{hospitalInfo.phone}}</text>
		</view>
		<view class="Signout">
			<button type="primary" plain="true" style="   position: absolute;margin-top: 100upx;border-radius:150upx;" @click="exit">
				退出登录
			</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				hospitalInfo:{}
			}
		},
		onLoad(e) {
			var that = this;
			console.log('请求userInfo', uni.getStorageSync('info'));
			uni.getStorage({
			    key: 'info',
			    success:(res) =>{
					let Info=res.data;
					let hospitalInfo=Info;
					that.hospitalInfo=hospitalInfo;
			       
			    }
			});
			
			
		},
		methods:{
			exit(e){
								uni.request({
								    url:this.$serverUrl + '/app/patient/usr/user/logout', //仅为示例，并非真实接口地址。
									data: {
										
								    },
									method:"POST",
									header:{
										'token': uni.getStorageSync('token'),
										'content-type': "application/json",
										'content-type': "application/x-www-form-urlencoded"
									}, 
								    success: (res) => {
								        // console.log(res.data.data.token);
								    	if(res.data.code==0){
								    		uni.setStorageSync('token', res.data.data.token);
											uni.setStorageSync('info', res.data.data.user);
											uni.removeStorage({
											    key: '',
											    success: function (res) {
											        console.log('success');
											    }
											});
								    		uni.navigateTo({
								    			url:'../Login/Login'
								    		})
								    	}else{
								    		uni.showToast({
								    		    title: res.data.msg,
								    		    duration: 2000
								    		});
								    	}
								    }
				});
			}
		}
	}
	

</script>

<style>
.loginView {
	display: flex;
	flex: 1;
	flex-direction: column;
	width: 750upx;
	min-height: 100vh;
	padding-top: 20upx;
	background-color:#f8f8f8;
}

.input-view {
	display: flex;
	border-bottom-style: solid;
	border-bottom-width: 2upx;
	border-bottom-color: #ddd;
	background-color: #fff;
	flex-direction: row;
	height: 110upx;
	width:100%;
	padding: 20upx 20upx;
	box-sizing: border-box;
}

.img{
	width: 60upx;
	height:60upx;
	border-radius: 20upx;
}
.showtele{
	width: 300upx;
	color: #a1a1a1;
	text-align: right;
	line-height:60upx;
}
.show {
	flex: 1;
	height: 60upx;
	line-height:60upx;
	font-size: 30upx;
	align-items: center;
}
.Signout{
	border-radius:20upx;
	color: #FFFFFF;
}
button {
	margin-left: 20upx;
	width: 710upx;
	height: 80upx;
	line-height: 70upx;
	text-align: center;
	font-size: 30upx;
	
}
button.exit{
	
}
</style>
